<script lang="ts" setup>
import { defineProps, computed } from 'vue';
import { TgaGameModel } from '@/api/webSite/response';

const { gameInfo } = defineProps<{
  gameInfo: TgaGameModel
}>();

const bgImage = computed(() => {
  return `background-image:url('${gameInfo.cover}');;background-size: cover;`
})

function gotoAdVedio() {
  window.open(gameInfo.video, "_blank");
}

</script>

<template>
  <div class="blog-card spring-fever" @click="gotoAdVedio" :style="bgImage">
    <div class="title-content">
      <h3>{{ gameInfo.name }}</h3>
      <hr />
      <div class="intro">
        <p>国家：<span>{{ gameInfo.country }}</span></p>
        <p>获奖时间：<span>{{ gameInfo.awardTime }}</span></p>
      </div>
    </div>
    <div class="card-info">
      <p>
        {{ gameInfo.desc }}
      </p>
    </div>
    <div class="utility-info">
      <ul class="utility-list">
        <li class="date">发布时间：{{ gameInfo.publishTime }}</li>
      </ul>
    </div>
    <div class="gradient-overlay"></div>
    <div class="color-overlay"></div>
  </div>
</template>

<style scoped lang="scss">
// variables
$card-width: 350px;
$card-height: 500px;
$h-color: #9CC9E3;
$yellow: #D0BB57;
$txt-color: #DCE3E7;


.blog-card {
  width: $card-width;
  height: $card-height;
  position: relative;
  margin-top: 20px;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 3px 3px 20px rgba(0, 0, 0, .5);
  text-align: center;
  cursor: pointer;

  .color-overlay {
    background: rgba(84, 104, 110, 0.4);
    width: $card-width;
    height: $card-height;
    position: absolute;
    z-index: 10;
    top: 0;
    left: 0;
    transition: background .3s cubic-bezier(.33, .66, .66, 1);
  }

  .gradient-overlay {
    background-image: -webkit-linear-gradient(rgba(0, 0, 0, 0.00) 0%, rgba(0, 0, 0, .6) 21%);
    background-image: -moz-linear-gradient(rgba(0, 0, 0, 0.00) 0%, rgba(0, 0, 0, .6) 21%);
    background-image: -o-linear-gradient(rgba(0, 0, 0, 0.00) 0%, rgba(0, 0, 0, .6) 21%);
    background-image: linear-gradient(rgba(0, 0, 0, 0.00) 0%, rgba(0, 0, 0, .6) 21%);
    width: $card-width;
    height: $card-height;
    position: absolute;
    top: 350px;
    left: 0;
    z-index: 15;
  }

  &:hover {

    .card-info {
      opacity: 1;
      bottom: 120px;
    }

    .color-overlay {
      background: rgba(84, 104, 110, 0.8);
    }
  }
}

.title-content {
  text-align: center;
  margin: 70px 0 0 0;
  position: absolute;
  z-index: 20;
  width: 100%;
  top: 0;
  left: 0;
}

h3 {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 2px;
  color: $h-color;
  font-family: 'Roboto', sans-serif;
  margin-bottom: 0;
}

hr {
  width: 50px;
  height: 3px;
  margin: 20px auto;
  border: 0;
  background: $yellow;
}

.intro {
  width: 170px;
  margin: 0 auto;
  color: $txt-color;
  font-family: 'Droid Serif', serif;
  font-size: 13px;
  font-style: italic;
  line-height: 18px;
}

.card-info {
  width: 100%;
  position: absolute;
  bottom: 100px;
  left: 0;
  margin: 0 auto;
  padding: 0 50px;
  color: $txt-color;
  font-family: 'Droid Serif', serif;
  font-style: 16px;
  line-height: 24px;
  z-index: 20;
  opacity: 0;
  transition: bottom .3s, opacity .3s cubic-bezier(.33, .66, .66, 1);
}

.utility-info {
  position: absolute;
  bottom: 0px;
  left: 0;
  z-index: 20;
}

.utility-list {
  list-style-type: none;
  margin: 0 0 30px 20px;
  padding: 0;
  width: 100%;

  li {
    margin: 0 15px 0 0;
    padding: 0 0 0 22px;
    display: inline-block;
    color: $txt-color;
    font-family: 'Roboto', sans-serif;
  }
}
</style>
